#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

#include <assert.h>
#include <string.h>
//模拟实现memcpy,返回目的的地址
//void* my_memcpy(void* destination, const void* resource, size_t num)
//{
//	assert(destination && resource);
//	//void* 不能被直接赋值
//	void* ret = destination;
//	while (num--)
//	{
//		*(char*)destination = *(char*)resource;
//		((char*)destination)++;
//		((char*)resource)++;
//	}
//	return ret;
//
//}
//void test1()
//{
//	int arr1[] = { 1,2,3,4,5,6,7,8,9,10 };
//	int arr2[10] = { 0 };
//	my_memcpy(arr2, arr1 + 2, 20);
//}
//void test2()
//{
//	int arr1[] = { 1,2,3,4,5,6,7,8,9,10 };
//	//1,2,3,4,5,6,7,8,9,10
//	//1,2,1,4,5,6,7,8,9,10
//	//1,2,1,2,5,6,7,8,9,10
//	//1,2,1,2,1,2,1,8,9,10
//	//my_memcpy(arr1, arr1+2, 20);
//	my_memcpy(arr1+4, arr1+2, 20);
//}
//void test3()
//{
//	int arr1[] = {1,2,3,4,5,6,7,8,9,10};
//	memmove(arr1+2, arr1, 20);
//}
//int main()
//{
//	//test2();
//	test3();
//	return 0;
//}

//memmove 实现重叠内存的拷贝

//模拟实现memmove
void* my_memmove(void* destination,const void* source,size_t num)
{
	assert(destination&&source);

}
int main()
{
	int arr1[] = { 1,2,3,4,5,6,7,8,9,10 };
	my_memmove(arr1,arr1+2,20);
	return 0;
}